package com.inspur.servlet;

import com.inspur.bean.Category;
import com.inspur.service.impl.CategoryServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @Author：齐文勇
 * @Package：${PACKAGE_NAME}
 * @Project：ProductMS
 * @name：${NAME}
 * @Date：2024/11/27 15:28
 * @Filename：${NAME}
 */
@WebServlet(urlPatterns = "/ProductInitAddServlet")
public class ProductInitAddServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        List<Category> categoryList = new CategoryServiceImpl().findAll();
        request.setAttribute("categoryList",categoryList);
        request.getRequestDispatcher("pages/product/save.jsp").forward(request,response);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
